feat!: add modular resource fetcher adapters for Expo and bare React Native#759
Conversation
|
Lint CI fails (you don't need to worry about the second failing CI ;)). Please could you fix the errors from this CI? |
|
@msluszniak I’m not able to reproduce the lint CI failure locally — everything passes on my side. I’ll take a closer look and investigate further to see what might be causing the discrepancy (environment, cache, or config differences). I’ll follow up with a fix or more details as soon as I find the root cause.
|
|
@rizalibnu Sure thing, maybe the configuration of the CI itself does not work with as it should. We'll also look at this, don't worry :) |
|
@msluszniak Found the issue 👍 Fixed by adding a build step before adapter type checks and bumped Node to 22 in |
72914c0 to
359427b
Compare
|
Also I think that adding these changes will make section |
|
Hi, I worked a bit with this PR by building bare react native app. From what I've tested I didn't get a single issue with the bare resource fetcher and the integration was also very smooth. To sum up my experience with it was good and I don't have any issues. Thank you @rizalibnu for this amazing piece of code :D |
|
The last thing from my side is to add |
e06996f to
1407899
Compare
1b95894 to
f9d9449
Compare
Add modular resource fetcher adapters to support both Expo and bare React Native environments. - Expo-based resource fetcher using expo-file-system - Supports asset bundles, local files, and remote downloads - Download management with pause/resume/cancel capabilities - Bare React Native resource fetcher using RNFS and background downloader - Supports all platform-specific file operations - Background download support with proper lifecycle management - Refactor ResourceFetcher to use adapter pattern - Add initExecutorch() and cleanupExecutorch() for adapter management - Export adapter interfaces and utilities - Update LLM controller to support new resource fetching - Update computer-vision, llm, speech-to-text, text-embeddings apps - Add adapter initialization to each app - Update dependencies to use workspace packages
Co-authored-by: Jakub Chmura <92989966+chmjkb@users.noreply.github.com>
chmjkb
left a comment
There was a problem hiding this comment.
overall looks good, thanks @rizalibnu @msluszniak
one more thing - the current README is now obsolete. Can we update it? 🙏🏻
Added installation instructions for Expo and bare React Native projects.
## Description Adds a new bare React Native example application demonstrating LLM chat functionality using Executorch. This example provides a complete reference implementation for running local LLM inference on mobile devices through a simple chat interface. **Key features:** - Local LLM inference using Executorch - Simple chat UI with message history - Model loading and inference pipeline - Error handling and user feedback - Compatible with both iOS and Android ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [ ] Bug fix (change which fixes an issue) - [x] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [ ] Other (chores, tests, code style improvements etc.) ### Tested on - [x] iOS - [x] Android ### Testing instructions 1. Navigate to the example directory: `cd apps/bare_rn` 2. Install dependencies: `yarn install` 3. Run on iOS: `npx pod-install` `yarn ios` Or run on Android: `yarn android` 4. Verify the app launches and displays the chat interface 5. Test message sending and model inference (requires model file setup) ### Screenshots [ <img width="1040" height="1037" alt="Screenshot 2026-01-28 at 02 06 29" src="https://github.com/user-attachments/assets/3774f4d2-ccc0-414b-85e7-3e26b06249ad" /> ](url) ### Related issues This PR provides an example app for PR #759 ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes This example app was generated using `npx @react-native-community/cli@latest init bare_rn --version 0.81.5 --pm yarn` and follows bare React Native project structure (not Expo). It serves as a foundational example for developers to understand how to integrate Executorch for on-device LLM inference in their React Native applications. **Why this example is not included in the yarn workspace:** The bare React Native example is maintained outside the yarn workspace structure due to fundamental architectural differences and specific technical issues: 1. Native Module Resolution Issues with Background Downloader: Using the workspace monorepo breaks the Android app's integration with `@kesha-antonov/react-native-background-downloader`. The monorepo's package hoisting and workspace resolution interferes with the native module's ability to properly register and resolve its native components. This causes runtime failures when attempting to download AI models in the background, which is a critical feature for this LLM chat example. 2. Dependency Isolation: Bare React Native projects have distinct native dependency chains (iOS Pods, Android Gradle) that conflict with the monorepo's package management. The monorepo uses workspaces and hoisting strategies optimized for JavaScript/TypeScript packages, which can interfere with native module resolution. --------- Co-authored-by: Mateusz Słuszniak <mateusz.sluszniak@swmansion.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Mateusz Sluszniak <56299341+msluszniak@users.noreply.github.com> Co-authored-by: Norbert Klockiewicz <Nklockiewicz12@gmail.com>

Description
This PR introduces modular resource fetcher adapters to support both Expo and bare React Native environments, replacing the previous monolithic approach with a flexible, platform-specific architecture.
Key Changes
New Adapter Packages:
Initialization Changes:
Documentation Updates:
Introduces a breaking change?
Migration Required:
Users must now explicitly initialize the library with a resource fetcher adapter:
Type of change
Tested on
Testing instructions
For Expo projects:
yarn add @rn-executorch/expo-adapter expo-file-system expo-assetinitExecutorch({ resourceFetcher: ExpoResourceFetcher })For bare React Native projects:
yarn add @rn-executorch/bare-adapter @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloaderinitExecutorch({ resourceFetcher: BareResourceFetcher })Screenshots
Related issues
Closes #549
Checklist
Additional notes
Why This Change:
Split Into Multiple PRs:
To make review easier, this work has been split:
BREAKING CHANGE:
initExecutorch()with explicit adapter selection is now required before using any react-native-executorch hooks. Users must install and configure either@rn-executorch/expo-adapteror@rn-executorch/bare-adapterdepending on their project type.